package com.heima.admin.controller.v1;


import com.heima.admin.service.AdUserService;
import com.heima.api.admin.AdUserControllerApi;
import com.heima.model.admin.dtos.AdUserDto;
import com.heima.model.admin.pojos.AdUser;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 管理员用户信息表 前端控制器
 * </p>
 * @author tps
 * @since 2021-01-09
 */
@RestController
@Api(tags="用户测试")
@RequestMapping("/login")
public class AdUserController implements AdUserControllerApi {
    @Autowired
    AdUserService adUserService;


    @PostMapping("/in")
    @Override
    @ApiOperation("登录")
    public ResponseResult login(@RequestBody AdUserDto adUserDto){
        return adUserService.login(adUserDto);
    }

    @Override
    @PostMapping("/register")
    @ApiOperation("注册")
    public ResponseResult regist(@RequestBody AdUser adUser) {
        return adUserService.regist(adUser);
    }
}
